package com.zhijian.medical.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 脱水流程
 *
 * @author HCG
 * @version 1.0
 * @date 2022/9/13
 */
@AllArgsConstructor
@Getter
public enum RoutineRsEnum {

    // 当前所处节点：0-流程结束；1-二甲苯①；2-二甲苯②；3-无水乙醇①；4-无水乙醇②；5-95%乙醇①；6-95%乙醇②；7-80%乙醇①；8-80%乙醇②；
    // 9-自来水洗；10-苏木素；11-自来水洗；12-1%盐酸酒精；13-自来水洗；14-伊红；15-自来水洗；16-85%乙醇；17-90%乙醇；18-95%乙醇①；
    // 19-95%乙醇②；20-无水乙醇①；21-无水乙醇②；22-二甲苯①；23-二甲苯②；24-封片
    OVER(0, "流程结束"),

    ONE(1, "二甲苯①"),
    TWO(2, "二甲苯②"),
    THREE(3, "无水乙醇①"),
    FOUR(4, "无水乙醇②"),
    FIVE(5, "95%乙醇①"),

    SIX(6, "95%乙醇②"),
    SEVEN(7, "80%乙醇①"),
    EIGHT(8, "80%乙醇②"),
    NINE(9, "自来水洗"),
    TEN(10, "苏木素"),

    ELEVEN(11, "自来水洗"),
    TWELVE(12, "1%盐酸酒精"),
    THIRTEEN(13, "自来水洗"),
    FOURTEEN(14, "伊红"),
    FIFTEEN(15, "自来水洗"),

    SIXTEEN(16, "85%乙醇"),
    SEVENTEEN(17, "90%乙醇"),
    EIGHTEEN(18, "95%乙醇①"),
    NINETEEN(19, "95%乙醇②"),
    TWENTY(20, "无水乙醇①"),

    TWENTY_ONE(21, "无水乙醇②"),
    TWENTY_TWO(22, "二甲苯①"),
    TWENTY_THREE(23, "二甲苯②"),
    TWENTY_FOUR(24, "封片");

    private Integer code;
    private String desc;

    public static RoutineRsEnum getByCode(Integer code) {
        RoutineRsEnum[] values = RoutineRsEnum.values();
        for (RoutineRsEnum anEnum : values) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return null;
    }

    public static Map<String,String> getMap(){
        RoutineRsEnum[] values = RoutineRsEnum.values();
        Map<String, String> map = new HashMap<>();
        for (RoutineRsEnum anEnum : values) {
            if (anEnum.getCode() != 0) {
                map.put(anEnum.getCode() + "",anEnum.getDesc());
            }
        }
        return map;
    }
}
